






//
//  OffBuildingSearchView.m
//  住房条件帅选器
//
//  Created by MB__Lee on 2018/5/18.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "OffBuildingSearchView.h"

@interface OffBuildingSearchView()<AreaTableviewDelegate,BaseTypeTableVeiwDelegate,PriceTableviewDelegate>

@property(nonatomic,strong)BaseHousePostModel *model;

@end

@implementation OffBuildingSearchView

#pragma mark ----方法实现
-(instancetype)initWithFrame:(CGRect)frame btnMut:(NSArray *)btnMut{
    if (self = [super initWithFrame:frame btnMut:btnMut]) {
        self.postModel.category = @"1003";
        _model = self.postModel;
    }
    return  self;
}


#pragma mark --- 子视图的代理方法
//1/选择区域的返回数据


//- (void)AreaTableview:(AreaTableview *)areTable sendDistriceModel:(ArDistrictModel *)disctricName regionModel:(ArRegionModel *)regionName {
//    _model.district = disctricName.code;
//    _model.region = regionName.code;
//    [self resetFrameAndRemoveView:areTable];
//    
//}
//2--- 面积 ---使用 --根据模型里面的 属性值来判断
-(void)BaseTypeTableVeiw:(BaseTypeTableVeiw *)tableview sendModel:(BaseModel *)model{
    _model.square_end = model.value_end;
    _model.square_start = model.value_start;
    
    [self resetFrameAndRemoveView:tableview];
    
}
//3、---租金使用
-(void)priceTableview:(PriceTableview *)priceTableview priceModel:(PriceModel *)priceModel{
    
    _model.rent_end = priceModel.value_end;
    _model.rent_start = priceModel.value_start;
    [self resetFrameAndRemoveView:priceTableview];
    
}

//4、--- 特色      ---使用
-(void)BaseTypeTableVeiw:(BaseTypeTableVeiw *)tableview sendSelectedIndexPathString:(NSString *)contentString{
    _model.characteristic = contentString;
    [self resetFrameAndRemoveView:tableview];
    
}






//-(instancetype)creatSearchView{
//    OffBuildingSearchView *re  = [[[self class] alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, MBScale(49)) btnMut:@[@"住宅",@"租金",@"面积",@"特色"]];
//    
//    // 区域
//    AreaTableview *area =[[AreaTableview alloc] initWithFrame:CGRectMake(0, MBScale(50), re.bounds.size.width, ArCellHeight * 7)];
//    area.delegate = re;
//    
//    
//    //租金
//    BaseTypeTableVeiw *rent =[MutiBaseFactory creatTableviewWithBaseType:BaseTypeModel withFrame:CGRectMake(0, MBScale(50), re.bounds.size.width, MBScale(370))];
//    [rent setMinPlaceHolder:@"最低价格" max:@"最高价格"];
//    
//    GetRentSource *rentTool = [[GetRentSource alloc] init];
//    [rentTool priceTableview_getRentSourceWithCategory:@"1001" success:^(NSArray *arr) {
//        rent.sourceMut = [NSMutableArray arrayWithArray:arr];
//    } failure:^(NSError *err) {
//        
//    }];
//    rent.BaseDelegate = re;
//    
//    
//    // 面积
//    BaseTypeTableVeiw *roomtype = [MutiBaseFactory creatTableviewWithBaseType:BaseTypeModel withFrame:CGRectMake(0, MBScale(50), re.bounds.size.width, MBScale(370))];
//    [roomtype setMinPlaceHolder:@"最小面积" max:@"最大面积"];
//    roomtype.BaseDelegate = re;
//    
//    
//    
//    CGFloat height = SCREEN_HIGHT - MBScale(50) - MBScale(64);
//    BaseTypeTableVeiw *charecter = [MutiBaseFactory creatTableviewWithBaseType:BaseTypeBase withFrame:CGRectMake(0, MBScale(50), re.bounds.size.width, MBScale(370))];
//    
//    charecter.BaseDelegate = re;
//    
//    
//    
//    re.viewArray = @[area,rent,roomtype,charecter];
//    
//    return  re;
//}


@end
